import * as actionTypes from './constants';

const defaultstate = {
    findData: {
        newLists: []
    },
    detailData: {}
}

const reducer = (state = defaultstate, action) => {
    const { type, data } = action;
    switch (type) {
        case actionTypes.CHANGE_FIND_DATA:
            let newData = {
                newLists: [
                    ...state.findData.newLists,
                    ...action.data.newLists
                ]
            }
            return { ...state, findData: newData }

        case actionTypes.CHANGE_DETAIL_DATA:
            console.log(data);
            return { ...state, detailData: data };

        default:
            return state;
    }
}
export default reducer;